/**
 * Email 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-20
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.Email;
import com.chnbst.bstyun.model.vo.EmailVo;
import com.chnbst.bstyun.service.EmailService;

@Transactional
@Service
public class EmailServiceImpl extends BaseService implements EmailService {
	
	//声明命名空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.EmailMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteEmail(Integer emailId) {
		return DaoHelper.delete(nameSpace, "deleteEmail", emailId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertEmail(Email email) {
		return DaoHelper.insert(nameSpace, "insertEmail", email);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateEmail(Email email) {
		return DaoHelper.update(nameSpace, "updateEmail", email);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public Email selectEmail(Integer emailId) {
		return (Email)DaoHelper.query(nameSpace, "selectEmail", emailId);
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<EmailVo> selectEmailVos(Map<String, Object> map) {
		return (List<EmailVo>)DaoHelper.list(nameSpace, "selectEmailVos", map);
	}

	@Override
	public EmailVo selectEmailVo(Integer emailId) {
		return (EmailVo)DaoHelper.query(nameSpace, "selectEmailVo", emailId);
	}
}
